package com.zhangfb95.crosschain.plugin.container.java.fabric2.infra.config.properties;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Accessors(chain = true)
@Component
@ConfigurationProperties("biz.service.fabric")
public class FabricProperties {

    private String chainName;
    private String user;
    private String mspId;
    private EnrollmentInfo enrollment;
    private List<PeerInfo> peers;
    private List<OrdererInfo> orderers;
    private ChaincodeEventInfo chaincodeEvent;

    @Data
    public static class EnrollmentInfo {

        private String keyText;
        private String certText;
    }

    @Data
    public static class PeerInfo {

        private String peerAddress;
        private String tlsCaFile;
        private String hostnameOverride;
        private String mspId;
    }

    @Data
    public static class OrdererInfo {

        private String ordererAddress;
        private String tlsCaFile;
        private String hostnameOverride;
        private String mspId;
    }

    @Data
    public static class ChaincodeEventInfo {

        private Boolean enable;
        private List<String> includeChannelNames;
    }
}
